<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@page import="com.asiainfo.util.SessionInfoUtil"%>
<%@page import="com.asiainfo.bean.UserSessionBean"%>

<%
    String path = request.getContextPath();
    UserSessionBean userSessBean = SessionInfoUtil.getUserSessBean(request.getSession());
    if(userSessBean == null){
		String str = "<script>"
				 +"window.location.href='"+path+"/loginController/login.do'"
		           + "</script>";
		response.getWriter().write(str);
		return;
	}else{ 
		request.setAttribute("userSessBean", userSessBean);
	}
 

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<title>掌上电信业务助手</title>
<link href="<%=path%>/view/css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/view/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="<%=path%>/view/css/default.css"/>
<link href="<%=path%>/view/css/styles.css" rel="stylesheet"/>
<script type="text/javascript">

</script>
<style>
.title{
	width:100%;
	position:absolute;
	top:0;
	background-color:#3cc;
	text-align:center;
	font-family:"Times New Roman", Times, serif;
}
.container{
	margin-top:60px;
}
.head{
	height:20px;
	line-height:20px;
	
}
.huanyin{
	text-align:center;
	height:20px;
	line-height:20px;
	width:250px;
	float:left;
}
.exit{
	text-align:center;
	height:20px;
	line-height:20px;
	width:100px;
	float:left;
}
#xiangqing{
	text-align:center;
	height:auto;
	
	line-height:20px;
	font-size:12px;
	z-index:99;
	background-color:white;
}
.news{
	margin-top:10px;
}
li{
	margin:0;
}
.gongneng{
	height:100px;
	border:1px solid #999;
	padding:0;
	margin-top:3px;
}
</style>
</head>
<body>
<div class="title">
	<h3>掌上电信业务助手</h3>
</div>
<div class="container">
	<div class="head">
		<div class="row">
			<div class="huanyin col-sm-3 col-sm-offset-2 col-xs-3 collapsed" data-toggle="collapse" data-target="#xiangqing">
				<p>欢迎您，<a id="username"><%=userSessBean.getUserName()%></a></p>
			</div>
			<div class="exit col-sm-2 col-sm-offset-3 col-xs-3">
				<span><a onclick="loginout()" id="loginout">退出</a></span>
			</div>
		</div>
		<div id="xiangqing" class="collapse col-sm-8 col-sm-offset-2">
			<div  class="row">
				<div class="col-sm-3">
					号码:<span id="number"><%=userSessBean.getPhone()%></span>
				</div>
				<div class="col-sm-3">
					归属地:<span id="address"><%=userSessBean.getCityName()%></span>
				</div>
				<div class="col-sm-3">
					运营:<span id="operator"><%=userSessBean.getOperatorName()%></span>
				</div>
				<div class="col-sm-3">
					话费余额:<span id="money"><%=userSessBean.getReal_time_balance()%>元</span>
				</div>
			</div>
		</div>
	</div>	
	<div class="news col-sm-8 col-sm-offset-2">
	<div class="stage">
		<div id="SLDR-ONE" class="sldr">
			<ul class="wrp animate">
				<li class="elmnt-one"><div class="skew"><div class="wrap"><img src="<%=path%>/view/img/dianxin.jpg" width="100%" height="auto"/></div></div></li>
				<li class="elmnt-two"><div class="skew"><div class="wrap"><img src="<%=path%>/view/img/liantong.jpg" width="100%" height="auto"/></div></div></li>
				<li class="elmnt-three"><div class="skew"><div class="wrap"><img src="<%=path%>/view/img/yidong2.png" width="100%" height="auto"/></div></div></li>
				<li class="elmnt-four"><div class="skew"><div class="wrap"><img src="<%=path%>/view/img/yidong.jpg" width="100%" height="auto"/></div></div></li>
			</ul>
		</div>
		<ul class="selectors">
			<li class="focalPoint"><a href="">•</a></li><li><a href="">•</a></li><li><a href="">•</a></li><li><a href="">•</a></li>
		</ul>

	</div>
</div>


	<div class="function col-sm-8 col-sm-offset-2">
		<div class="row">
			<button class="gongneng personalcenter col-sm-4 col-xs-4 btn" id="personalcenter">个人中心</button>
			<button class="gongneng safe col-sm-4 col-xs-4 btn" id="safe">手机安全</button>
			<button class="gongneng business col-sm-4 col-xs-4 btn" id="business">我的业务</button>
		</div>
		<div class="row">
			<button class="gongneng personalcenter col-sm-4 col-xs-4 btn" id="bltc">办理套餐</button>
			<button class="gongneng safe col-sm-4 col-xs-4 btn" id="blyw">办理业务</button>
			<button class="gongneng business col-sm-4 col-xs-4 btn"  type="button" id="znzs">智能助手</button>
		</div>
		<div class="modal fade" id="modal_znzs">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header"  style="text-align:center;height:40px;">
						<h4 class="modal-title">智能助手</h4>
					</div>
					<div class="modal-body">
						<div class="row">
							<a class="btn btn-primary col-sm-8 col-sm-offset-2 col-xs-10 col-xs-offset-1" onclick="mealAllowance()">套餐余额</a>
						</div>
						<div class="row">
							<a class="btn btn-primary col-sm-8 col-sm-offset-2 col-xs-10 col-xs-offset-1" onclick="monthBill()">当月消费情况</a>
						</div>
						<div class="row">
							<a class="btn btn-primary col-sm-8 col-sm-offset-2 col-xs-10 col-xs-offset-1" onclick="myBill()">我的账单</a>
						</div>
						<div class="row">
							<a class="btn btn-primary col-sm-8 col-sm-offset-2 col-xs-10 col-xs-offset-1" onclick="record()">充值记录</a>
						</div>
					</div>
					<div class="modal-footer" style="text-align:center;	">
						<button type="button" class="btn btn-default" data-dismiss="modal" >关闭</button>
					</div>
				</div><!-- /.modal-content -->
			</div><!-- /.modal-dialog -->
		</div><!-- /.modal -->
		<div class="modal fade" id="modal_personalcenter">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header"  style="text-align:center;height:40px;">
						<h4 class="modal-title">个人中心</h4>
					</div>
					<div class="modal-body">
						<div class="row">
							<a class="btn btn-primary col-sm-8 col-sm-offset-2 col-xs-10 col-xs-offset-1" href="#">我的信息</a>
						</div>
						<div class="row">
							<a class="btn btn-primary col-sm-8 col-sm-offset-2 col-xs-10 col-xs-offset-1" href="#">我的积分</a>
						</div>
						<div class="row">
							<a class="btn btn-primary col-sm-8 col-sm-offset-2 col-xs-10 col-xs-offset-1" href="#">我的订单</a>
						</div>
						<div class="row">
							<a class="btn btn-primary col-sm-8 col-sm-offset-2 col-xs-10 col-xs-offset-1" href="#">快速充值</a>
						</div>
					</div>
					<div class="modal-footer" style="text-align:center;	">
						<button type="button" class="btn btn-default" data-dismiss="modal" >关闭</button>
					</div>
				</div><!-- /.modal-content -->
			</div><!-- /.modal-dialog -->
		</div><!-- /.modal -->
		<div class="modal fade" id="modal_safe">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header"  style="text-align:center;height:40px;">
						<h4 class="modal-title">手机安全</h4>
					</div>
					<div class="modal-body">
						<div class="row">
							<a class="btn btn-primary col-sm-8 col-sm-offset-2 col-xs-10 col-xs-offset-1" href="#">我的安全信息</a>
						</div>
						<div class="row">
							<a class="btn btn-primary col-sm-8 col-sm-offset-2 col-xs-10 col-xs-offset-1" href="#">查询</a>
						</div>
						<div class="row">
							<a class="btn btn-primary col-sm-8 col-sm-offset-2 col-xs-10 col-xs-offset-1" href="#">黑名单</a>
						</div>
						<div class="row">
							<a class="btn btn-primary col-sm-8 col-sm-offset-2 col-xs-10 col-xs-offset-1" href="#">手机投诉</a>
						</div>
					</div>
					<div class="modal-footer" style="text-align:center;	">
						<button type="button" class="btn btn-default" data-dismiss="modal" >关闭</button>
					</div>
				</div><!-- /.modal-content -->
			</div><!-- /.modal-dialog -->
		</div><!-- /.modal -->
		<div class="modal fade" id="modal_bltc">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header"  style="text-align:center;height:40px;">
						<h4 class="modal-title">办理套餐</h4>
					</div>
					<div class="modal-body">
						<div class="row">
							<a class="btn btn-primary col-sm-8 col-sm-offset-2 col-xs-10 col-xs-offset-1" onclick="myAllOkMeal()">套餐办理</a>
						</div>
						<div class="row">
							<a class="btn btn-primary col-sm-8 col-sm-offset-2 col-xs-10 col-xs-offset-1" onclick="mealChoice()">靓号办理</a>
						</div>

					</div>
					<div class="modal-footer" style="text-align:center;	">
						<button type="button" class="btn btn-default" data-dismiss="modal" >关闭</button>
					</div>
				</div><!-- /.modal-content -->
			</div><!-- /.modal-dialog -->
		</div><!-- /.modal -->
		<div class="modal fade" id="modal_blyw">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header"  style="text-align:center;height:40px;">
						<h4 class="modal-title">办理业务</h4>
					</div>
					<div class="modal-body">
						<div class="row">
							<a class="btn btn-primary col-sm-8 col-sm-offset-2 col-xs-10 col-xs-offset-1" href="#">基础业务</a>
						</div>
						<div class="row">
							<a class="btn btn-primary col-sm-8 col-sm-offset-2 col-xs-10 col-xs-offset-1" href="#">流量优惠</a>
						</div>
						<div class="row">
							<a class="btn btn-primary col-sm-8 col-sm-offset-2 col-xs-10 col-xs-offset-1" href="#">语音套餐</a>
						</div>
						<div class="row">
							<a class="btn btn-primary col-sm-8 col-sm-offset-2 col-xs-10 col-xs-offset-1" href="#">短/彩信</a>
						</div>
					</div>
					<div class="modal-footer" style="text-align:center;	">
						<button type="button" class="btn btn-default" data-dismiss="modal" >关闭</button>
					</div>
				</div><!-- /.modal-content -->
			</div><!-- /.modal-dialog -->
		</div><!-- /.modal -->
		<div class="modal fade" id="modal_business">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header"  style="text-align:center;height:40px;">
						<h4 class="modal-title">我的业务</h4>
					</div>
					<div class="modal-body">
						<div class="row">
							<a class="btn btn-primary col-sm-8 col-sm-offset-2 col-xs-10 col-xs-offset-1" href="#">我开通的套餐</a>
						</div>
						<div class="row">
							<a class="btn btn-primary col-sm-8 col-sm-offset-2 col-xs-10 col-xs-offset-1" href="#">我开通的业务</a>
						</div>
						<div class="row">
							<a class="btn btn-primary col-sm-8 col-sm-offset-2 col-xs-10 col-xs-offset-1" href="#">办理业务历史记录</a>
						</div>
						<div class="row">
							<a class="btn btn-primary col-sm-8 col-sm-offset-2 col-xs-10 col-xs-offset-1" href="#">办理套餐历史记录</a>
						</div>
					</div>
					<div class="modal-footer" style="text-align:center;	">
						<button type="button" class="btn btn-default" data-dismiss="modal" >关闭</button>
					</div>
				</div><!-- /.modal-content -->
			</div><!-- /.modal-dialog -->
		</div><!-- /.modal -->
		
	</div>     
</div>
<script type="text/javascript" src="<%=path%>/view/js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="<%=path%>/view/js/jquery.js"></script>
<script type="text/javascript" src="<%=path%>/view/js/bootstrap.js"></script>
<script type="text/javascript" src="<%=path%>/view/js/bootstrap.min.js"></script>
<script type="text/javascript" src="<%=path%>/view/js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="<%=path%>/view/js/jquery.sldr.js"></script>
<script src="http://cdn.bootcss.com/bootstrap/2.3.1/js/bootstrap-transition.js"></script>
<script src="http://cdn.bootcss.com/bootstrap/2.3.1/js/bootstrap-modal.js"></script>

<script>
  $(function(){
    $("#znzs").click(function(){
      $("#modal_znzs").modal("toggle");
    });
  });
  $(function(){
    $("#personalcenter").click(function(){
      $("#modal_personalcenter").modal("toggle");
    });
  });
  $(function(){
    $("#safe").click(function(){
      $("#modal_safe").modal("toggle");
    });
  });
  $(function(){
    $("#business").click(function(){
      $("#modal_business").modal("toggle");
    });
  });
  $(function(){
    $("#blyw").click(function(){
      $("#modal_blyw").modal("toggle");
    });
  });
  $(function(){
    $("#bltc").click(function(){
      $("#modal_bltc").modal("toggle");
    });
  });
  
  
  
  

$( window ).load( function() {

	$( '.sldr' ).each( function() {
		var th = $( this );
		th.sldr({
			focalClass    : 'focalPoint',
			offset        : th.width() / 2,
			sldrWidth     : 'responsive',
			//nextSlide     : th.nextAll( '.sldr-nav.next:first' ),
			//previousSlide : th.nextAll( '.sldr-nav.prev:first' ),
			selectors     : th.nextAll( '.selectors:first' ).find( 'li' ),
			toggle        : th.nextAll( '.captions:first' ).find( 'div' ),
			sldrInit      : sliderInit,
			sldrStart     : slideStart,
			sldrComplete  : slideComplete,
			sldrLoaded    : sliderLoaded,
			sldrAuto      : true,
			sldrTime      : 3000,
			hasChange     : true
		});
	});

});

/**
 * Sldr Callbacks
 */

/**
 * When the sldr is initiated, before the DOM is manipulated
 * @param {object} args the slides, callback, and config of the slider
 * @return null
 */
function sliderInit( args ) {

}

/**
 * When individual slides are loaded
 * @param {object} args the slides, callback, and config of the slider
 * @return null
 */
function slideLoaded( args ) {

}

/**
 * When the full slider is loaded, after the DOM is manipulated
 * @param {object} args the slides, callback, and config of the slider
 * @return null
 */
function sliderLoaded( args ) {

}

/**
 * Before the slides change focal points
 * @param {object} args the slides, callback, and config of the slider
 * @return null
 */
function slideStart( args ) {

}

/**
 * After the slides are done changing focal points
 * @param {object} args the slides, callback, and config of the slider
 * @return null
 */
function slideComplete( args ) {

}


</script>
<script type="text/javascript">
 
 function loginout(){  
        
       	
       	var actionUrl= "<%=path%>/loginController/logout.do";
       	 
           $.ajax({  
               url:actionUrl,  
               type:"post",  
               dataType : "JSON",
			    cache:false,
			  
               success:function(data){  
               
               	window.location.href = "<%=path%>/loginController/login.do";	 
               }, 
           error: function(req) {
				alert("退出失败");
			}
           });  
            
        
      }  
 
 
  function mealAllowance(){
	 var actionUrl= "<%=path%>/helperController/mealAllowance.do";
	 var phone = <%=userSessBean.getPhone()%>;
	 
     $.ajax({  
         url:actionUrl,  
         type:"post", 
         data:JSON.stringify({phone:phone,
         }), 
         dataType : "JSON",
		    cache:false,
		    contentType:"application/json", 
         success:function(data){  
        	 if(data.flag == true){
         	window.location.href = "<%=path%>/helperController/mealAllowanceView.do";	 
        	 } else if(data.isNot == true){
        		 alert("未选择套餐或业务");		
        	 } else if(data.isNotOne == true){
        		 alert("所选套餐不止1个");	
        	 } 
        	 else if(data.flag == false){
        		 alert("失败");
        		 window.location.href = "<%=path%>/indexController/index.do";
        	 }
         }, 
         error: function(req) {
        	 alert("失败");
         	 window.location.href = "<%=path%>/indexController/index.do";	
        		}
     });  
 } 
  
  function monthBill(){
		 var actionUrl= "<%=path%>/myBillController/monthBill.do";
		 var phone = <%=userSessBean.getPhone()%>;
		 
	     $.ajax({  
	         url:actionUrl,  
	         type:"post", 
	         data:JSON.stringify({phone:phone,
	         }), 
	         dataType : "JSON",
			    cache:false,
			    contentType:"application/json", 
	         success:function(data){  
	        	 if(data.flag == true){
	         	window.location.href = "<%=path%>/myBillController/monthBillView.do";	 
	        	 }else if(data.flag == false){
	        		 alert("失败");
	        		 window.location.href = "<%=path%>/indexController/index.do";
	        	 }
	         }, 
	         error: function(req) {
	        	 alert("失败");
	         	 window.location.href = "<%=path%>/indexController/index.do";	
	        		}
	     });  
	 } 
	
  
  function myBill(){
	  window.location.href = "<%=path%>/myBillController/myBillView.do";	
  }
  
  
   function record(){
	  var actionUrl= "<%=path%>/rechargeController/record.do";
		 var phone = <%=userSessBean.getPhone()%>;
		 
	     $.ajax({  
	         url:actionUrl,  
	         type:"post", 
	         data:JSON.stringify({phone:phone,
	         }), 
	         dataType : "JSON",
			    cache:false,
			    contentType:"application/json", 
	         success:function(data){  
	        	 if(data.flag == true){
	         	window.location.href = "<%=path%>/rechargeController/recordView.do";	 
	        	 }
	        	 else if(data.nodata == true){
	        		 window.location.href = "<%=path%>/rechargeController/recordView.do";
	        	 }
	        	 else if(data.flag == false){
	        		 alert("失败");
	        		 window.location.href = "<%=path%>/indexController/index.do";
	        	 }
	         }, 
	         error: function(req) {
	        	 alert("失败");
	         	 window.location.href = "<%=path%>/indexController/index.do";	
	        		}
	     });  
  } 
   
   
   function myInfo(){
		  var actionUrl= "<%=path%>/userController/myInfo.do";
			 var phone = <%=userSessBean.getPhone()%>;
			 
		     $.ajax({  
		         url:actionUrl,  
		         type:"post", 
		         data:JSON.stringify({phone:phone,
		         }), 
		         dataType : "JSON",
				    cache:false,
				    contentType:"application/json", 
		         success:function(data){  
		        	 if(data.flag == true){
		         	window.location.href = "<%=path%>/userController/myInfoView.do";	 
		        	 }
		        	 
		        	 else if(data.flag == false){
		        		 alert("失败");
		        		 window.location.href = "<%=path%>/indexController/index.do";
		        	 }
		         }, 
		         error: function(req) {
		        	 alert("失败");
		         	 window.location.href = "<%=path%>/indexController/index.do";	
		        		}
		     });  
	  } 
   
   function myAllOkMeal(){
		 var actionUrl= "<%=path%>/mealController/myAllOkMeal.do";
		 var phone = <%=userSessBean.getPhone()%>;
	     $.ajax({  
	         url:actionUrl,
	         data:JSON.stringify({phone:phone,
	        	 }),
	         type:"post", 
	         dataType : "JSON",
			    cache:false,
			    contentType:"application/json", 
	         success:function(data){  
	        	 if(data.flag == true){
	         	window.location.href = "<%=path%>/mealController/mealListView.do";	 
	        	 } else if(data.isNot == true){
	        		 alert("未选择套餐或业务");		
	        	 } else if(data.isNotOne == true){
	        		 alert("所选套餐不止1个");	
	        	 }else if(data.flag == false){
	        		 alert("失败");
	        		// window.location.href = "<%=path%>/indexController/index.do";
	        	 }
	         }, 
	         error: function(req) {
	        	 alert("失败");
	        		}
	     });  
	 } 
   function mealChoice(){
		 var actionUrl= "<%=path%>/liangController/mealChoice.do";
		 var phone = <%=userSessBean.getPhone()%>;
	     $.ajax({  
	         url:actionUrl,
	         data:JSON.stringify({
	        	 phone:phone,
	        	 }),
	         type:"post", 
	         dataType : "JSON",
			    cache:false,
			    contentType:"application/json", 
	         success:function(data){  
	        	 if(data.flag == true){
	         	window.location.href = "<%=path%>/liangController/mealChoiceView.do";
	        	 }else if(data.flag == false){
	        		 alert("失败");
	        		// window.location.href = "<%=path%>/indexController/index.do";
	        	 }
	         }, 
	         error: function(req) {
	        	 alert("失败");
	        		}
	     });  
	 } 

</script>  

<!-- 以下两个插件用于在IE8以及以下版本浏览器支持HTML5元素和媒体查询，如果不需要用可以移除 -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</body>
</html>
